package com.ruoyi.domain;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.ruoyi.common.annotation.Excel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.math.BigDecimal;
import java.time.LocalTime;

@Data
@TableName(" order_item")
public class OrderDetailBom {



//BOM的内容
    private String parentMaterialId;    // 母件编码，主键
    private String parentMaterialName;  // 物料名称
    private String specification;       // 物料规格
    private LocalTime versionDate;           // 版本日期
    private Integer approvalStatus;     // 审核状态
    private Integer attachmentStatus;   // 附件上传状态
    private String createdBy;           // 创建人


    @TableField(exist = false)
    private LocalTime createdDate;
    // 创建日期
    private String lastModifiedBy;      // 最后修改人
    @TableField(exist = false)
    private LocalTime lastModifiedDate;      // 最后修改日期



    //物料表
    @TableField(value = "material_code")
    @ApiModelProperty(value = "物料编码", required = true)
    //接不到要么容器类型不匹配 要么容器名字对不上
    private String materialCode;

    @TableField(value = "material_name")

    @ApiModelProperty(value = "物料名称", required = true)
    private String materialName;

    @TableField(value = "material_specification")
    @ApiModelProperty(value = "规格型号")
    private String materialSpecification;

    @TableField(value = "unit")
    @ApiModelProperty(value = "单位", required = true)
    private String unit;

    @TableField(value = "type_id")
    @ApiModelProperty(value = "物料类型ID", required = true)
    private Integer typeId;

    @TableField(value = "category_id")
    @ApiModelProperty(value = "物料分类ID")
    private Integer categoryId;

    @TableField(value = "min_stock")
    @ApiModelProperty(value = "最小库存")
    private BigDecimal minStock;

    @TableField(value = "max_stock")
    @ApiModelProperty(value = "最大库存")
    private BigDecimal maxStock;

    @TableField(value = "safe_stock")
    @ApiModelProperty(value = "安全库存")
    private BigDecimal safeStock;

    @TableField(value = "status")
    @ApiModelProperty(value = "状态(0:停用,1:启用)", example = "1")
    private Integer status;

    @TableField(value = "remark")
    @ApiModelProperty(value = "备注")
    private String remark;

//    @TableField(value = "created_at", fill = FieldFill.INSERT)
//    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
//    @ApiModelProperty(value = "创建时间")
//    private Date createdAt;
//
//    @TableField(value = "updated_at", fill = FieldFill.INSERT_UPDATE)
//    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
//    @ApiModelProperty(value = "更新时间")
//    private Date updatedAt;

    @TableField(value = "order_id")
    @ApiModelProperty(value = "关联采购表ID")
    private Integer orderId;

    // 以下是可能需要的关联字段（非数据库字段）
    @TableField(exist = false)
    @ApiModelProperty(value = "物料类型名称")
    private String typeName;

    @TableField(exist = false)
    @ApiModelProperty(value = "物料分类名称")
    private String categoryName;


    //请购细目表
    @TableId(type = IdType.AUTO)
    private Integer id;                    // 明细ID，主键
    private Long purchaseRequestId;     // 关联请购单管理表ID
    private String productSku;          // 商品SKU
    private BigDecimal quantity;    // 请购数量

@TableField(exist = false)
    private LocalTime createTime;            // 创建时间

    @TableField(exist = false)
    private LocalTime updateTime;            // 更新时间

    private Integer purchaseDetail;     // 关联bom中的物料id



    //请购表
    @Excel(name = "创建人")
    private String creator;
    @Excel(name = "来源单据")
    private String sourceDoc;


    /** 明细唯一ID */
    private Integer itemId;

        /** 关联请购单ID */
        private Integer requisitionId;

    /** 关联物料ID */
    private Integer materialId;




    /** 预估单价 */
    private BigDecimal price;

    /** 预估总价（自动计算） */
    private BigDecimal totalPrice;


}
